import Mock from 'mockjs'
import user from './json/user'

Mock.setup({
  timeout: '1000 * 12'
})

function login (params) {
  const paramObj = JSON.parse(params.body)
  if (paramObj.userName === user.userName && paramObj.password === user.password) {
    return {
      code: 0,
      desc: '操作成功',
      data: null
    }
  } else {
    return {
      code: -1,
      desc: '操作失败',
      data: null
    }
  }
}
Mock.mock('/data', 'post', login)
